package com.lxw.study.behavioral.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Client {
    public static void main(String[] args) {
        MyArrayList list = new MyArrayList();
        list.add("张三");
        list.add("李斯");
        Iterator iterator = list.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println("next = " + next);
        }
    }

    private static void ArrayListIterator() {
        List list = new ArrayList<>();
        list.add("张三");
        list.add("李四");
        Iterator iterator = list.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println("next = " + next);
        }
        iterator.hasNext();
    }
}
